package com.jxpanda.commons.toolkit;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;

/**
 * 随机工具
 *
 * @author Panda
 */
@SuppressWarnings("UnusedReturnValue")
public class RandomKit {

    public static String nextString() {
        return RandomStringUtils.randomAlphabetic(6);
    }

    public static String nextString(int digit) {
        return RandomStringUtils.randomAlphabetic(digit);
    }

    public static int nextInt(int startInclusive, int endExclusive) {
        return RandomUtils.nextInt(startInclusive, endExclusive);
    }

    /**
     * 返回随机的整型随机数
     */
    public static int nextInt(int digit) {
        int ceiling = (int) Math.pow(10, digit);
        int floor = (int) Math.pow(10, digit - 1);
        return nextInt(floor, ceiling);
    }

    /**
     * 返回6位数随机整数
     */
    public static int nextInt() {
        return nextInt(6);
    }

    /**
     * 返回double类型的随机数
     */
    public static double nextDouble() {
        return RandomUtils.nextDouble();
    }

    public static double nextDouble(double from, double to) {
        return RandomUtils.nextDouble(from, to);
    }

}
